<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./lib/vue-2.4.0.js"></script>
</head>

<body>
    <div id="app">
        <button v-on:click="lang">浪起来</button>
        <input type="button" value="低调" @click="didiao">
        <h4>{{msg}}</h4>
    </div>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                msg: '猥琐发育，别浪~~!',
                cc:null,
            },
            methods: {
                lang() {
                    if(this.cc!=null) return null;
                    // var _this = this
                    // console.log(_this.msg)
                    this.cc=setInterval(()=>{
                        // console.log(this)
                        // console.log(_this)
                        var start = this.msg.substring(0, 1)
                        var end = this.msg.substring(1)
                        this.msg = end + start
                    }, 100)
                },
                didiao:function(){
                    console.log(this)
                    clearInterval(this.cc)
                    this.cc=null
                }


            },

        })
    </script>
</body>

</html>